# -*-coding:utf-8 -*-
import socket
localhost = "0.0.0.0"
# localhost = "10.10.6.199"
port = 18090
server_sk = socket.socket()
server_sk.bind((localhost, port))
server_sk.listen(5)
print("等待程序链接……")
conn, address = server_sk.accept()
print(f"客户端 {address} 已连接")
# 打印客户端的 IP 地址
client_ip, client_port = address
print(f"客户端 IP 地址: {client_ip}, 客户端端口号: {client_port}")

conn.sendall(bytes("连接成功！", encoding='utf-8'))
ret = str(conn.recv(1024), encoding='utf-8')
print("收到客户端信息是：", ret)

# 关闭连接
conn.close()
server_sk.close()
